<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class AdminController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function setlog($data,$content){

        $ip= $_SERVER["REMOTE_ADDR"];
        $user = Auth::user();
        $insert=array(
            'uid'=>$user->id,
            'username'=>$user->name,
            'ip'=>$ip,
            'type'=>'1',
            'content'=>$content,
            'data'=>$data,
            'created_at'=>date("Y-m-d H:i:s")
        );
        DB::table("action_log")->insert($insert);
    }
}
